package codename.primavera.web.exception;

import javax.faces.context.ExceptionHandler;
import javax.faces.context.ExceptionHandlerFactory;

/**
 * Used by the JSF2-framework to construct Application-specific
 * {@link ExceptionHandler}. {@link}<a href=
 * "http://weblogs.java.net/blog/edburns/archive/2009/09/03/dealing-gracefully-viewexpiredexception-jsf2"
 * >JSF2 Exception handler</a>{@link}
 */
public class PrimaveraExceptionHandlerFactory extends ExceptionHandlerFactory {

    /**
     * the parent.
     */
    private ExceptionHandlerFactory parent;

    /**
     * Called by the framework to construct custom factories.
     * @param someParent the parent
     */
    public PrimaveraExceptionHandlerFactory(final ExceptionHandlerFactory someParent) {
        parent = someParent;
    }

    /** {@inheritDoc} */
    @Override
    public ExceptionHandler getExceptionHandler() {
        return new PrimaveraExceptionHandler(parent.getExceptionHandler());
    }

}
